UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pS8Z6G7GPiu/cMxWJhCQHBOEf8MB5M0sx3hy5ZVZRgA=' 
WHERE 
  key_id = '96dbdbd64b69e7630d89ccc960cded9170e363b37fa8cad0f48b4a62c54e8faa' 
  AND (
    token = 'pS8Z6G7GPiu/cMxWJhCQHBOEf8MB5M0sx3hy5ZVZRgA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021