UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'INnubGK88PfQGecU0c8Oz1BR+02L5FgJ8ZePAiyRO44=' 
WHERE 
  key_id = 'ff5d7b022c65d286020c483de9812b3103625ea05b31030627fd0e608b526e7e' 
  AND (
    token = 'INnubGK88PfQGecU0c8Oz1BR+02L5FgJ8ZePAiyRO44=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051