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