UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bra8dt4ZsgJuUfteyDODpBBw0KrQEb1X2BtoH3iCCMo='
WHERE
key_id = '41b7874e69e069a7715d1d899162e377d6f04f49a476ba05d87bc1b04cf25791'
AND (
token = 'Bra8dt4ZsgJuUfteyDODpBBw0KrQEb1X2BtoH3iCCMo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)