UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wTitMcTpqjNlKsgGxbtQeOO7HY0oEGxWseLYZb55DhQ=' 
WHERE 
  key_id = '3122ad61346668cb54713819c688b4f86a266c47291f3972b246009c6d0a6ac9' 
  AND (
    token = 'wTitMcTpqjNlKsgGxbtQeOO7HY0oEGxWseLYZb55DhQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046