UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1X328OX3qlJEUEAQ+MuoT+J8oYAmTm+un5Vr/zaW/6Y='
WHERE
key_id = '9879f569adf2233454fd1c76f73f8e2d770ffb41801794a61077abdf5b7c0596'
AND (
token = '1X328OX3qlJEUEAQ+MuoT+J8oYAmTm+un5Vr/zaW/6Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)