UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VBKElck2AK8GE0R/j3+6LfbnovB0J37ngRSk11zp8j8='
WHERE
key_id = 'ecf432dca59b6c809bbe1fde29ac81abd44d0162c7620789fee781a14144b9ff'
AND (
token = 'VBKElck2AK8GE0R/j3+6LfbnovB0J37ngRSk11zp8j8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)