UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'msPXQyUuopoxfpzbVNcOYl73Qr8zf8WCXGyW14kfX5s='
WHERE
key_id = '180c7e3b97cefd96f57c6cd1c6b9f797429875a72b04b344f0834f3cd72147cd'
AND (
token = 'msPXQyUuopoxfpzbVNcOYl73Qr8zf8WCXGyW14kfX5s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)