UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bohKk7TwZUDQAsiwfB0hcNAPeghOgPkW0PEwIG1CMiU='
WHERE
key_id = '2e7e4d300e4fb5760f5119feda97d4449f0058c70e08db51b21344b933fe593a'
AND (
token = 'bohKk7TwZUDQAsiwfB0hcNAPeghOgPkW0PEwIG1CMiU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)