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