UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YbzveTVY2cpNqTwVvhYN3J5qb2ai3oTfIVHHrC02aZY=' 
WHERE 
  key_id = 'c5ab4284ee9133e565141c65a65829ea7b7ca53d7679dd8455804892e65543e9' 
  AND (
    token = 'YbzveTVY2cpNqTwVvhYN3J5qb2ai3oTfIVHHrC02aZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019