UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QkMSDq8MPu54Sb/XYgbxLe2yiTnzj0LAszI284YW70U=' 
WHERE 
  key_id = '8f7361441de8df92e8e1d5aabb193a55f2e33fc50b49665617fac2b99d2dcfa2' 
  AND (
    token = 'QkMSDq8MPu54Sb/XYgbxLe2yiTnzj0LAszI284YW70U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021