UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KSAWJew0j4vTegapC6xQpYxWs9SWKuVQIflGmqGM0rE=' 
WHERE 
  key_id = '91254e334e1bd4a167836d70aa08fa17be9d06c2566454f61605cead1c4c86c8' 
  AND (
    token = 'KSAWJew0j4vTegapC6xQpYxWs9SWKuVQIflGmqGM0rE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044