UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZhsojtP6f3OQE/tvPVppzmhoT24axUeYIX1NfaU9pmA='
WHERE
key_id = 'c1da0e09daa11e2e0c59f5d23d677b145f823d557136265b6ae48f83c16c316c'
AND (
token = 'ZhsojtP6f3OQE/tvPVppzmhoT24axUeYIX1NfaU9pmA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)