UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yd1Nysb94kMuhu3AJ9aypr3Cg6cAgS4vooIGLQ1WAtE=' 
WHERE 
  key_id = '25ddf70717870b3efab6d854ca50174ce381cf0c881f191959ada834ecc1c3b1' 
  AND (
    token = 'Yd1Nysb94kMuhu3AJ9aypr3Cg6cAgS4vooIGLQ1WAtE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022