UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HLlp3GGKYAWhlMT3MUS+GSIDC/tV1HMI/ADr9SLHK8Q=' 
WHERE 
  key_id = '3cfa175a1b5b023d888470e0103852224356a20e242d74edc98242e268a4feab' 
  AND (
    token = 'HLlp3GGKYAWhlMT3MUS+GSIDC/tV1HMI/ADr9SLHK8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015