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