UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i+9yU0ZrxzoutPAAthRlEE9QI5aF9iIGE7S1Enfyty8='
WHERE
key_id = '89031e94b56632b2e3e225447495b9dd8c8d4207446c2e97aa58f7fcabe38b45'
AND (
token = 'i+9yU0ZrxzoutPAAthRlEE9QI5aF9iIGE7S1Enfyty8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)