UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xOXWDowLuncwg03j8TZCWnmxUT8Rh5hh+3edGzb3Kg0='
WHERE
key_id = 'caa0029f037611cb4d3dcad6feb3e3af971826cfc77519aaea36374a221376ea'
AND (
token = 'xOXWDowLuncwg03j8TZCWnmxUT8Rh5hh+3edGzb3Kg0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)