UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iVHxtuVjWMbqG7lMdx5h/UuASmaPpRSZU/5qSGOZiGs='
WHERE
key_id = 'd4e1a7b9e9180681ba3b6445c26c2f73f381d55864a968cac870421fea8c18c8'
AND (
token = 'iVHxtuVjWMbqG7lMdx5h/UuASmaPpRSZU/5qSGOZiGs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)