UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wSRuCixp021zqkBFIBlYUHgPmY2+ElBpwgbkVX2WMmg='
WHERE
key_id = 'ee85001c5b10d9009a07ec8064f09a995ca85524bb7d12d82ddca9b7d04395ec'
AND (
token = 'wSRuCixp021zqkBFIBlYUHgPmY2+ElBpwgbkVX2WMmg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)