UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'COYHEf5S4tZm0htma4pQyHpGVEQArC+bMmv0iSCSw8s='
WHERE
key_id = 'e65998eeb75c8df4f091609087254e5dc3ee1f92c08b0df7283e7338d8ba1ba3'
AND (
token = 'COYHEf5S4tZm0htma4pQyHpGVEQArC+bMmv0iSCSw8s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)