UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J5B7Ha14Ps2C3TXA81gTX95sLRp8za9RMaVEc1hB544=' 
WHERE 
  key_id = '4f3eeb445ca1452c351239e65a33674f9f3532fce83c966af54cc566eb82711d' 
  AND (
    token = 'J5B7Ha14Ps2C3TXA81gTX95sLRp8za9RMaVEc1hB544=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026