UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B1vbEG1vREt47nduY/GwfNsJuvgbUAl+r8rmcTMVxDU='
WHERE
key_id = '6ce48a3744ecc52ec8032ef9ba792c635b0b2f72c120a1ec1a92e8a75a766f3a'
AND (
token = 'B1vbEG1vREt47nduY/GwfNsJuvgbUAl+r8rmcTMVxDU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)