UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yd5VZld41LMNNSaYNUcxWwapKbtHJsbDf6bmjnXtCTM=' 
WHERE 
  key_id = '52154aa0ed0e5d7c4d6089603972c79c5aee8118213b4280f530a90cc8de4802' 
  AND (
    token = 'Yd5VZld41LMNNSaYNUcxWwapKbtHJsbDf6bmjnXtCTM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020