UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VWkWn9YVn1Jj4iueYCyKO/RY09bRNyplz5eI3zKMPDM='
WHERE
key_id = '1b61af7a2cf015aff2bc7a65eb11ab325778fdd4857f7b8a1bede0d7cd1e169b'
AND (
token = 'VWkWn9YVn1Jj4iueYCyKO/RY09bRNyplz5eI3zKMPDM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)