UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ou747U+GigVJal2EhZPnwAoa2IIMZJEDwI0Y8PW3FM0='
WHERE
key_id = 'b1e06bd759b99400e33fd2f599df65b18243b05001c223eaf1a21c6f71251c62'
AND (
token = 'ou747U+GigVJal2EhZPnwAoa2IIMZJEDwI0Y8PW3FM0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)