UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dPGrpT1ifjvvtTwNVWFomNa1sQyTi2QVzr1M53PjY1o='
WHERE
key_id = 'dac3301a9349d722f8947dec44010b12329295fc859f5d8faf971d5e874e91e3'
AND (
token = 'dPGrpT1ifjvvtTwNVWFomNa1sQyTi2QVzr1M53PjY1o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)