UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IQHtcgvYZUEXWsSxlJZK3hLYy1YZqNAtDd/T+woEWq0='
WHERE
key_id = 'd58a70c46bfbe29178988b2bb57ddab61e1e1f82e40e3bd244100530dac9b4cd'
AND (
token = 'IQHtcgvYZUEXWsSxlJZK3hLYy1YZqNAtDd/T+woEWq0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)