UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IdQHE6YCn9pX0BmYZ1TD2BKAKnB2Mee8S/9MdUTakUg=' 
WHERE 
  key_id = '79cd9441f11613d7922ac85bdd04cea004a4d103360e2e90a9b5fd7296a58ef4' 
  AND (
    token = 'IdQHE6YCn9pX0BmYZ1TD2BKAKnB2Mee8S/9MdUTakUg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025