UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y1AWik9/AI4SjOyueO5uqyZN3mk2679gJ0uXJDftQw0=' 
WHERE 
  key_id = '377c8ffd6ac013f84c5f6ea5381c9fd791fe627c6dfdd1564fed230de1effc5f' 
  AND (
    token = 'y1AWik9/AI4SjOyueO5uqyZN3mk2679gJ0uXJDftQw0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022