UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i1zA8Q1dewsnI7bt9hlavnDB9wXn+k67WxdqTv+NL8k='
WHERE
key_id = '117c522e14e9e495fca59ef57ef0ba565421ad8531058b55e244c0d3194f37ba'
AND (
token = 'i1zA8Q1dewsnI7bt9hlavnDB9wXn+k67WxdqTv+NL8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)