UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yXf/893MOblabre2611U338BuvhVHtxmx5ficO0qWfE=' 
WHERE 
  key_id = 'c03d2f204de4efed31a31916b2b77d929d59f2469af8bc72818c4f8f4f9123f4' 
  AND (
    token = 'yXf/893MOblabre2611U338BuvhVHtxmx5ficO0qWfE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077