UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HD9RuKH7IFw1aE+lKRn8NLK4QRyq1jayrgCsgK7At/g='
WHERE
key_id = 'fd587921c22c9f2b1fdc033f41e44d832a97526a4ece7a66cbded87416982728'
AND (
token = 'HD9RuKH7IFw1aE+lKRn8NLK4QRyq1jayrgCsgK7At/g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)