UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r/L+kpw5hh6z3w2whcfnh7+AwsPXUAnWc1TI2aqPHqU=' 
WHERE 
  key_id = '85ebc3760907df9da43289f822486dff062df3f94b3d9d58c5e69b513b4bf8b6' 
  AND (
    token = 'r/L+kpw5hh6z3w2whcfnh7+AwsPXUAnWc1TI2aqPHqU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038