UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rOqAfFb84UfNXEO6BCeua38+EZkmS9+pgBuhZH+id+g=' 
WHERE 
  key_id = 'e717d530b5995e497f1b9a044cea26bd8483e110b29fbc8fb3ab35d044c382fe' 
  AND (
    token = 'rOqAfFb84UfNXEO6BCeua38+EZkmS9+pgBuhZH+id+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034