UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2fz9tpqrDi3ZE2Ji2ichsxf5MazsQD1Ijuq8EwZH65A=' 
WHERE 
  key_id = '9d18ac1691e477e14841165f394e0589f82741c978fd6de0d497b2ec22cf21b7' 
  AND (
    token = '2fz9tpqrDi3ZE2Ji2ichsxf5MazsQD1Ijuq8EwZH65A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058