UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jJ++4V6y88N7bOg9fcOjq+8M5jndrqaEtwM1wSYuL58='
WHERE
key_id = 'd69f02a62cc62bd8977a9033341c40a01ad4f5ade212e1c8d1b9b87ef42edd58'
AND (
token = 'jJ++4V6y88N7bOg9fcOjq+8M5jndrqaEtwM1wSYuL58='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)