UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rz6CCymSRpkt3C8Cv1AINazCsJQVlsHIvcxjIvmUQL4=' 
WHERE 
  key_id = '7a5d9445f2ae79d57de42e485aeaa17a4df6058079b1b4b52dba9583bb0f1d1e' 
  AND (
    token = 'Rz6CCymSRpkt3C8Cv1AINazCsJQVlsHIvcxjIvmUQL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021