UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BOrJNl6QO/IV67QF6SPZ3a3ITqh2QWxXiw7R6cPIcr0='
WHERE
key_id = 'c27089950cf9f70b582129561a846a4b8ca42f16ac684e9e0ec75f9adfe3906c'
AND (
token = 'BOrJNl6QO/IV67QF6SPZ3a3ITqh2QWxXiw7R6cPIcr0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)