UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm6THEaB1whLMJmZ9F635p0qfnonrdDoyQVScYQH1ATg=' 
WHERE 
  key_id = '951f362a8039472ec8104a69a5456fa6a96c56baee3b604edfea699d27697db6' 
  AND (
    token = 'm6THEaB1whLMJmZ9F635p0qfnonrdDoyQVScYQH1ATg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029