UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4oBUAgZcMcYvNlOIdNxlgAUl83Pb6oPONrY1iZ645w4='
WHERE
key_id = 'b55f5984abbfc150777e6cc1c788553cc24478438cfea5e9dda0a89d1017cbfb'
AND (
token = '4oBUAgZcMcYvNlOIdNxlgAUl83Pb6oPONrY1iZ645w4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)