UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4NhtcNa1oXlVB88eJfsSVN+PuJOZIfNvPh1pZ+CUXFs=' 
WHERE 
  key_id = '936631035fe22f58bcdd1276c994150467c7c1aab9b655bf4c02f30841893b89' 
  AND (
    token = '4NhtcNa1oXlVB88eJfsSVN+PuJOZIfNvPh1pZ+CUXFs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049